using System;
using System.Collections.Generic;
using DataContracts;
using TrainingWorkshop.MVPWebsite.Role;
using Microsoft.Practices.CompositeWeb;
using TrainingWorkshop.MVPWebsite.Role.Interface;

namespace TrainingWorkshop.MVPWebsite
{
    public class RoleController : IRoleController
    {
        private Role.Interface.Services.IRoleService _roleService;
        public RoleController()
        {
        }

        [ServiceDependency]
        public Role.Interface.Services.IRoleService RoleService
        {
            set { _roleService = value; }
        }

        public List<StatusDTO> GetAllRoleStatus()
        {
            return _roleService.GetAllRoleStatus();
        }

      
        public List<RoleViewDTO> SearchRole(string roleName, string status, string authorities, string sortExpression, string sortDirection, double PageSize, int PageIndex, out int pageCnt)
        {
            return _roleService.SearchRole(roleName, status, authorities, sortExpression, sortDirection, PageSize, PageIndex, out  pageCnt);
        }
        

        public RoleDTO GetRoleById(int roleId)
        {

            return _roleService.GetRoleById(roleId);
        }

        public void UpdateRole(RoleDTO role)
        {
            _roleService.UpdateRole(role);
        }

        public void AddNewRole(RoleDTO role)
        {
            _roleService.AddNewRole(role);
        }

        public List<AuthorityDTO> GetAllAuthority()
        {
            return _roleService.GetAllAuthority();
        }


        public List<RoleDTO> GetAllRole(string roleName, int status)
        {
            return _roleService.GetAllRole(roleName, status);
        }

        public void DeleteRole(int roleId)
        {
            _roleService.DeleteRole(roleId);
        }

        public void BatchUpdateRoleStatus(List<RoleDTO> roleList)
        {
            _roleService.BatchUpdateRoleStatus(roleList);
        }

           public StatusDTO GetRoleStatusById(int statusId)
        {
            return _roleService.GetRoleStatusById(statusId);
        }

    }
}
